package cn.yiufung.designPattern.singleton;

/**
 * 饿汉式单例（静态常量方式）
 * @author 姚锋
 * @createTime 2023年08月24日 23:06:00
 */
public class EagerStaticAttributeSingleton {

    private EagerStaticAttributeSingleton(){}

    //加final在类加载的准备阶段赋值（待验证）
    private static final EagerStaticAttributeSingleton eagerStaticAttributeSingleton
            = new EagerStaticAttributeSingleton();

    public static EagerStaticAttributeSingleton getInstance(){
        return eagerStaticAttributeSingleton;
    }

}
